*********************************************
*	Author: Rithika Kumar	                *
*   Table A13 (Appendix D)                   * 
*********************************************

** Set working directory to "JOP Replication files" folder on your computer 

use "DATA FILES TO SHARE/inc_earned_EW_analysis", clear

*1. Regression with salary from wage/salary work


quietly reghdfe SALARYEARN w2_abshusband_dummy##year if URBAN == 0 & ws_both_wave > 1, vce(cluster IDPSU)
eststo reg_salary


quietly reghdfe SALARYEARN year##w2_abshusband if URBAN == 0 & ws_both_wave > 1 , absorb(DISTID) vce(cluster IDPSU)
eststo reg_salary_distfe


quietly reghdfe SALARYEARN w2_abshusband##year if URBAN == 0 & ws_both_wave > 1 , absorb(IDPSU) vce(cluster IDPSU)
eststo reg_salary_villfe


** EACH HH HAS ONE PERSON ITNERVIEWED SO IT CREATES A UNIQUE CODE FOR THE HH AND YEAR COMBO 
** This will create HH FE 
 destring hhuid_using2005, generate(uid_num)

reghdfe SALARYEARN year##w2_abshusband if URBAN == 0 & ws_both_wave > 1 , absorb(uid_num)  vce(cluster IDPSU)
eststo reg_salary_hhfe
 
 ** 2. 
 
use "DATA FILES TO SHARE/ihds_wages.dta", clear 
reghdfe FMDAYS i.w2_abshusband_dummy##i.year EW_Age EW_health dil_dummy INCOME anotherst_dummy if FM1==1 &URBAN==0 & did_sample ==1, absorb(hhuid_num) vce(cluster IDPSU) 
eststo control_mech_FMDAYS

foreach i in  farm_lab WKNONAG NF1{
	
quietly reghdfe `i' i.w2_abshusband_dummy##i.year EW_Age EW_health dil_dummy INCOME anotherst_dummy if URBAN==0 & did_sample ==1, absorb(hhuid_num) vce(cluster IDPSU) 
eststo control_mech_`i'
}


esttab control* reg_salary* using "OUTPUT/TABLES/Table_A13.tex", replace title("Male migration does not have a significant effect on non-farm work") ///
    label  ///
    prehead("\begin{table}[H]" "\small" "\centering" "\caption{Male migration does not have a significant effect on non-farm work}" ///
            "\begin{tabular}{lcccccccc}" "\toprule" ///
			"& Own farm days & Farm Labor & Non-Farm Wage Labor & Non-farm business & \multicolumn{4}{c}{{Salary Earned}}\\" ///
            "&(1)&(2)&(3)&(4)&(5)&(6)&(7)&(8)\\" "\hline") ///
    posthead("") keep(1.w2_abshusband_dummy 1.year 1.w2_abshusband_dummy#1.year) varlabels(1.w2_abshusband_dummy "Migrant Husband"  1.year "Wave 2" 1.w2_abshusband_dummy#1.year "Migrant Husband $\times$ Wave 2") ///
	stats( r2_a N, fmt(%9.4f %9.0f) labels("Adj R-sq" "Observations")) cells(b(fmt(a2) star) se(par fmt(a2))) starlevels(* 0.10 ** 0.05 *** 0.01) style(tex) collabels(, none) mlabels(, none) ///
     postfoot(  "Fixed Effects &Individual & Individual & Individual & Individual & None & District &Village &Household\\" "\bottomrule" "\end{tabular}" "\label{tab:main_wages_inc}" "\begin{tablenotes}" ///
             "\noindent Notes: DID analysis using individual and household level employment and farm data show that male migration does not have a significant effect on salary or non-farm wage labor. Column 1 only includes women in households with cultivated land. Standard errors are clustered at the village level (primary sampling unit). The results suggest that non-farm salary and wage labor are unlikely to increase and create a pathway for female autonomy" "\end{tablenotes}" "\end{table}")

